<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #img1 {
            width: 50px;
            height: 40px;
        }
    </style>
    <script>
        function $(id) {
            return document.getElementById(id)//命名一个函数用于获取DOM对象
        }
        function gwj() {
            if ($('baidu').checked) {
                $('img1').src = "./百度图标.png"
                $('anniu').value = '百度一下'
                $('biaodan').action = 'https://www.baidu.com/s'
                $("txt1").name = 'wd'
            } else if ($('sougou').checked) {
                $('img1').src = './搜狗图标.png'
                $('anniu').value = '搜狗一下'
                $('biaodan').action = 'https://www.sogou.com/web'
                $('txt1').name = 'query'
            } else {
                $('img1').src = './360图标.png'
                $('anniu').value = '360一下'
                $('biaodan').action = 'https://www.so.com/s'
                $('txt1').name = 'q'
            }

        }
    </script>
</head>

<body>
    <form action="https://www.baidu.com/s" id="biaodan">
        <input type="radio" name="index" id="baidu" onclick="gwj();"><label for="baidu">百度</label> <!--label 停留文字时会点击按钮 -->
        <input type="radio" name="index" id="sougou" onclick="gwj();"><label for="sougou">搜狗</label>
        <input type="radio" name="index" id="my360" onclick="gwj();"><label for="my360">360</label>
        <br>
        <br>
        <img src="./百度图标.png" id="img1">
        <br>
        <input type="text" name="wd" id="txt1" placeholder="输入关键词">
        <input type="submit" value="百度搜索" id="anniu">
    </form>
</body>

</html>